Skip to content

Fix subscription initialization retries for transient WAL reads - #18829

Merged
jt2594838 merged 1 commit into
apache:masterfrom
Caideyipi:fix/subscription-wal-init-retry
Oct 14, 2026
Merged

jt2594838 merged 1 commit into
apache:masterfrom
Caideyipi:fix/subscription-wal-init-retry

Conversation

@Caideyipi

Copy link
Copy Markdown
Collaborator

Description

A transient NoSuchFileException during the initial region-progress WAL lookup was treated as a locate failure and thrown from poll, producing SUBSCRIPTION_POLL_ERROR (1904). This can interrupt consumers while a WAL filename is changing during rolling.

Carry an explicit RETRY_LATER decision for deferred reads and leave prefetch initialization dormant until a subsequent poll completes the lookup. Recovery frontiers and the replay cursor are installed only after a successful lookup. Confirmed retained WAL corruption remains a lookup failure, including scans that also encounter a temporarily unreadable live file.

The regression tests reproduce a file disappearing between directory listing and opening, repeated unreadable polls followed by recovery, retained corruption, and corruption followed by a deferred live-file read. Recovery checks verify that committed records are skipped and the remaining records replay exactly once without WAL gap increments.

Validation

  • The new tests reproduce two initialization exceptions before the fix; all four pass with the fix.
  • Related queue, seek, initialization, and WAL iterator tests: 75 tests, 0 failures, 0 errors, 1 optional performance test skipped.
  • English and Chinese full-reactor test compilation passed: mvn test-compile -DskipTests and mvn test-compile -DskipTests -P with-zh-locale.
  • The original 3C3D workload has not been rerun.

This PR has:

  • been self-reviewed.
  • added comments explaining the retry and corruption distinction.
  • added unit tests covering the new behavior.
Key changed/added classes

ConsensusPrefetchingQueue, ConsensusPrefetchingQueueInitializationTest

Comment on lines +1262 to +1268
final String detail =
"replay lookup did not complete: " + iterator.getIncompleteScanDetail();
// Retry only a deferred read. Confirmed corruption encountered earlier in the scan must
// still surface as a lookup failure, even if a later file is temporarily unreadable.
return iterator.isWaitingForReadableWal() && !iterator.hasSkippedBrokenWalFiles()
? ReplayLocateDecision.retryLater(regionProgress, detail)
: ReplayLocateDecision.locateMiss(regionProgress, detail);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i18n

@jt2594838
jt2594838 merged commit 510fc7c into apache:master Oct 14, 2026
38 of 39 checks passed
@jt2594838
jt2594838 deleted the fix/subscription-wal-init-retry branch October 14, 2026 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants